﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using com.IronOne.BoardPACWinAppBO.Category;
using com.IronOne.BoardPACWinAppDAO.Category;

namespace com.IronOne.BoardPACWinAppService.Category
{
    public class CategoryService : ICategoryService
    {
        private readonly ICategoryDAO _categoryDAO;

        public CategoryService()
        {
            _categoryDAO = new CategoryDAO();
        }

        public async Task<List<CategoryModel>> GetCategories()
        {
            try
            {
                return await _categoryDAO.GetCategories();
            }
            catch (Exception)
            {
                throw;
            }
        }

        public async Task<List<SubCategoryModel>> GetSubCategories()
        {
            try
            {
                return await _categoryDAO.GetSubCategories();
            }
            catch (Exception)
            {
                throw;
            }
        }

        public async Task<List<SubCategoryModel>> GetSubCategoriesByCategoryId(int categoryId)
        {
            try
            {
                return await _categoryDAO.GetSubCategoriesByCategoryId(categoryId);
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
}